package entity;


import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: IoT201759225309
 * @description: User实体类
 * @author: Xiaozhuoer
 * @create: 2021-06-01 14:17
 **/
@Component
public class User {
    private int id;
    private String username;
    private String password;
    private String email;
    private int type; //0:管理者 1:开发者 2:普通用户 3:设备

    @Override
    public String toString() {
        return "user{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                ", type=" + type +
                '}';
    }
    public String toTokenString(){
        return  "type=" + type +
                "-id=" + id +
                "-username=" + username +
                "-password=" + password +
                "-email=" + email
                ;
    }
    public Map<String, String> toMap(){
        Map<String ,String> UserMap = new HashMap();
        UserMap.put("id",String.valueOf(this.getId()));
        UserMap.put("username",this.username);
        UserMap.put("password",this.password);
        UserMap.put("email",this.email);
        return UserMap;
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }
}
